package com.qq.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.qq.bean.Dynamics;
import com.qq.service.DynamicsService;
import com.qq.service.impl.DynamicsServiceImpl;
@WebServlet("/Dynamics.do")
public class DynamicsServlet extends HttpServlet{
	@Override
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		DynamicsService dy = new DynamicsServiceImpl();
		String account = request.getParameter("account");
		List<Dynamics> dynamic = dy.selectMyfriendAllDynamics(account);
		System.out.println(dynamic);
		ObjectMapper mapper = new ObjectMapper();
		String json = mapper.writeValueAsString(dynamic);
		response.setContentType("application/json;charset=utf-8");
		mapper.writeValue(response.getWriter(), json);
		
		
	}
}
